<#compress>
    <#assign actionname>${(action=='create')?string('新建','编辑')}</#assign>
    <@override name="title">${actionname}ktv项目</@override>
    <@override name="viewbody">
    <div class="row">
        <div class="col-md-12">
            <h3 class="page-title">
            ${actionname}项目
                <small>${actionname}项目.</small>
            </h3>
            <ul class="page-breadcrumb breadcrumb">
                <li>
                    <i class="fa fa-home"></i>
                    <a href="${ctx}/admin/home">
                        首页
                    </a>
                    <i class="fa fa-angle-right"></i>
                </li>
                <li>
                    <a href="${ctx}/admin/ktv/ktv">
                        KTV项目管理
                    </a>
                    <i class="fa fa-angle-right"></i>
                </li>
                <li>
                    <a href="#"> ${actionname}KTV项目</a>
                </li>
            </ul>
        </div>
    </div>

    <div class="panel panel-default">
        <div class="panel-heading"><h6 class="panel-title">ktv项目信息</h6></div>
        <div class="panel-body">
            <form class="form-horizontal" action="${ctx}/admin/ktv/ktv/save" role="form" id="ktvform"
                  method="post">
                <input name="ktv.id" type="hidden" value="${(ktv.id)!}"/>

                <div class="form-group">
                    <label class="col-sm-2 control-label" for="brandName">项目名称: <span class="required">*</span></label>

                    <div class="col-sm-10">
                        <input type="text" class="required form-control input-xlarge" placeholder="项目名称"
                               name="ktv.name" id="brandName" value="${(ktv.name)!}">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label" for="brand">品牌: <span class="required">*</span></label>

                    <div class="col-sm-10">
                        <select data-placeholder="品牌选择" name="ktv.brand" id="brand"
                                class="required form-control input-xlarge select2me" tabindex="-1">
                            <option value=""></option>
                            <#if brands??>
                                <#list brands as item>
                                    <option value="${item.id}" <#if ktv.brand?? && ktv.brand == item.id>selected </#if>>${item.name}</option>
                                </#list>
                            </#if>
                        </select>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label" for="begin_time">开始时间: <span class="required">*</span></label>

                    <div class="col-sm-10">
                        <div class="input-group input-medium date form_datetime" data-link-field="begin_time">
                            <input class="required form-control" size="16" type="text" value="${(ktv.begin_time)!}" name="ktv.begin_time"
                                   id="begin_time">
                            <span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
                            <span class="input-group-addon"><span class="glyphicon glyphicon-th"></span></span>
                        </div>
                        <input type="hidden" id="ktv.begin_time" name="begin_time" value="">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label" for="end_time">结束时间: <span class="required">*</span></label>

                    <div class="col-sm-9">
                        <div class="input-group input-medium date form_datetime"
                             data-link-field="end_time">
                            <input class="required form-control" size="16" type="text" value="${(ktv.end_time)!}"
                                   name="ktv.end_time" id="end_time">
                            <span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
                            <span class="input-group-addon"><span class="glyphicon glyphicon-th"></span></span>
                        </div>
                        <input type="hidden" id="ktv.end_time" name="end_time" value=""/>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-md-2 control-label">优惠详情:</label>

                    <div class="col-md-10">
                        <textarea class="form-control input-xlarge" placeholder="优惠详情" name="ktv.remark" rows="3">${ktv.remark!}</textarea>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-md-2 control-label">预定规则:</label>

                    <div class="col-md-10">
                        <textarea class="form-control input-xlarge" placeholder="预定规则" name="ktv.rule" rows="3">${ktv.rule!}</textarea>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label" for="brandName">项目图片: <span class="required">*</span></label>

                    <div class="col-sm-10">
                        <div class="fileinput fileinput-exists">
                            <input type="hidden" value="${ktv.logo!}" name="ktv.logo">

                            <div class="fileinput-btn">
                                <span class="btn default btn-file" >
                                    <span class="fileinput-new" id="logo_image_btn">&nbsp;</span>
                                </span>
                                <#if ktv.logo??><a href="#" data-data="${ktv.logo}" class="btn default fileinput-exists fileinput-remove">删除图片</a></#if>
                            </div>
                            <div class="fileinput-preview thumbnail"
                                 style="width: 200px; height: 150px; line-height: 150px;">
                                <#if ktv.logo??><a href="${ctx}${ktv.logo}" class="thumbnail fancybox-button">
                                    <img class="" src="${ctx}${ktv.logo?replace('.','.thumbnail.')}" alt="">
                                </a></#if>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label" for="brandName">预定价格: <span class="required">*</span></label>

                    <div class="col-sm-10">
                        <input type="text" class="required number form-control input-xlarge" placeholder="预定价格"
                               name="ktv.price" value="${(ktv.price)!}">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label" for="brandName">可预定数量: <span class="required">*</span></label>

                    <div class="col-sm-10">
                        <input type="text" class="required number form-control input-xlarge" placeholder="可预定数量"
                               name="ktv.numbers" value="${(ktv.numbers)!}">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label" for="seq_field">次序: <span class="required">*</span></label>

                    <div class="col-sm-9">
                        <div id="spinner1">
                            <div class="input-group input-small">
                                <input type="text" class="required spinner-input form-control " id="seq_field" name="ktv.order_id"
                                       value="${ktv.order_id!}"
                                       maxlength="3" readonly>

                                <div class="spinner-buttons input-group-btn btn-group-vertical">
                                    <button type="button" class="btn spinner-up btn-xs blue">
                                        <i class="fa fa-angle-up"></i>
                                    </button>
                                    <button type="button" class="btn spinner-down btn-xs blue">
                                        <i class="fa fa-angle-down"></i>
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-md-2 control-label" for="mo_prictures">&nbsp; </label>

                    <div class="col-md-10">
                        <p class="form-control-static">
                            <input id="prictureAttachmentUpload" type="file" class="btn">
                        </p>
                        <input type="hidden" id="mo_prictures" name="ktv.picture" value="${ktv.picture!}">
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-12 picture_grid" id="pricture-grid">
                        <div class="margin-top-10">
                            <div class="row">
                                <#if pics??>
                                    <#list pics as pic>
                                        <div class="col-sm-6 col-md-3 picture">
                                            <a href="${ctx}${pic}" class="thumbnail fancybox-button">
                                                <img class="" src="${ctx}${pic?replace('.','.thumbnail.')}" alt="">
                                            </a>
                                            <a href="#" class="action" data-hook="remove_picture" data-target="#mo_prictures"
                                               data-data="${pic!}"><i class="fa fa-times"></i> </a>
                                        </div>
                                    </#list>
                                </#if>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="form-actions text-right">
                    <a class="btn default yellow-stripe" href="${ctx}/admin/ktv/ktv"><i
                            class="fa fa-arrow-circle-o-left"></i> 返回</a>
                    <input type="submit" value="保存" class="btn btn-primary">
                </div>

            </form>
        </div>

    </div>


    <script id="showpics-template" type="text/x-handlebars-template">
        <div class="col-sm-6 col-md-3 picture">
            <a href="{{ctx}}{{preview}}" class="thumbnail fancybox-button" data-rel="fancybox-button">
                <img class="" src="{{ctx}}{{data}}" alt="">
            </a>

            <a href="#" class="action" data-hook="remove_picture" data-target="#mo_prictures"
               data-data="{{preview}}"><i class="fa fa-times"></i> </a>
        </div>
    </script>
    </@override>

    <@override name="viewparams">
    g.preview_template = '#showpics-template';
    </@override>


    <@override name="viewmodule">ktv_item</@override>
    <@extends name="../../_basic/main.ftl"></@extends>
</#compress>